﻿function Init()
{
	//ToolTip
	if (typeof(_lang) != "undefined" && (_lang == "UYG" || _lang == "KZA" || _lang == "KGA"))
		SetTip();
	
	if (typeof(_page) == "undefined")
		return;
	
	if (typeof(SetupIme) != "undefined")
		SetupIme();
	
	if (_page == "index")
	{
		$("#Search").submit(function()
		{
			var q = $.trim(this.q.value);
			if (q == "")
				return false;
			
			var url = $(this).find(":selected").val() + "?q=" + encodeURIComponent(q);
			if (this.target == "_blank")
				window.open(url)
			else
				window.location.href = url;
			return false;
		});
		
		$(".Block2 blockquote p").marquee("up", 2, 100).mouseover(function(){$(this).trigger("stop");}).mouseout(function(){$(this).trigger("start");});
		
		$(".TabMenu li").mouseover(function()
		{
		   var me = $(this);
		   if (!me.hasClass("Selected"))
		   {
			   me.siblings().removeClass("Selected");
			   me.addClass("Selected");
			   me.offsetParent().siblings(":visible").hide();
			   me.offsetParent().siblings().eq(me.offsetParent().children().index(this)).show();
		   }
		});
		
		$(".Block9 :button").click(function()
		{
			var parent = $(this).parent().eq(0);
			var index = parent.children().index(this);
			parent = parent.parent().eq(0);
			if (index == 0)
			{
				parent.find(":checkbox").each(function(){this.checked = true;});
			}
			else if (index == 1)
			{
				parent.find(":checkbox").each(function(){this.checked = !this.checked;});
			}
			else
			{
				var id = "";
				parent.find(":checked").each(function(){id += id == "" ? this.value : "|" + this.value;});
				if (id == "")
					Alert(_lang_no_music);
				else
					window.open(_playPage + "?ID=" + id, "_blank");
			}
		});
	
		//-----------------------------------------
		//Start : 添加入站
		var referrer = document.referrer;
		if (referrer != null && referrer != "" && referrer.indexOf("http://" + document.domain) != 0)
			$.post(_webPath + "alicms.aspx?Mark=Link&Object=Link&Operation=IncrementIn&Referrer=" + encodeURIComponent(referrer), {});
		//End : 添加入站
		//-----------------------------------------
	}
}

Init();